<%@ page import="myschool.entity.Subject" %>
<%@ page import="org.apache.ibatis.session.SqlSession" %>
<%@ page import="myschool.mybatisUtil.MybatisUtil" %>
<%@ page import="myschool.dao.GradeDao" %>
<%@ page import="myschool.dao.SubjectDao" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2023/6/5
  Time: 17:54
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    request.setCharacterEncoding("utf-8");
    String subName=request.getParameter("subName");
    String classHour = request.getParameter("classHour");
    String gradeID = request.getParameter("gradeID");

    Subject subject = new Subject();
    subject.setSubjectname(subName);
    subject.setClasshour(Integer.parseInt(classHour));
    subject.setGradeid((long) Integer.parseInt(gradeID));

    SqlSession s= MybatisUtil.get();
    SubjectDao mapper = s.getMapper(SubjectDao.class);
    mapper.add(subject);
    MybatisUtil.close(s);
    response.sendRedirect("../jsp6-6/Subject.jsp");
%>
</body>
</html>
